package com.es.disped.dao.mapper;

import com.es.disped.dao.model.Menu;
import com.es.disped.dao.model.MenuExample;
import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

//@CacheNamespace(implementation=(com.es.disped.dao.cache.RedisCache.class),size=512,flushInterval=60000)
public interface MenuMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=MenuSqlProvider.class, method="countByExample")
    long countByExample(MenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @DeleteProvider(type=MenuSqlProvider.class, method="deleteByExample")
    int deleteByExample(MenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Delete({
        "delete from menu",
        "where menu_id = #{menuId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String menuId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Insert({
        "insert into menu (menu_id, menu_parent_id, ",
        "menu_name, menu_description, ",
        "menu_url, menu_icon, ",
        "menu_index, menu_type, ",
        "menu_level, menu_valid)",
        "values (#{menuId,jdbcType=CHAR}, #{menuParentId,jdbcType=CHAR}, ",
        "#{menuName,jdbcType=VARCHAR}, #{menuDescription,jdbcType=VARCHAR}, ",
        "#{menuUrl,jdbcType=VARCHAR}, #{menuIcon,jdbcType=VARCHAR}, ",
        "#{menuIndex,jdbcType=INTEGER}, #{menuType,jdbcType=VARCHAR}, ",
        "#{menuLevel,jdbcType=INTEGER}, #{menuValid,jdbcType=INTEGER})"
    })
    int insert(Menu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @InsertProvider(type=MenuSqlProvider.class, method="insertSelective")
    int insertSelective(Menu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=MenuSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="menu_parent_id", property="menuParentId", jdbcType=JdbcType.CHAR),
        @Result(column="menu_name", property="menuName", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_description", property="menuDescription", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_url", property="menuUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_icon", property="menuIcon", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_index", property="menuIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_type", property="menuType", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_level", property="menuLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_valid", property="menuValid", jdbcType=JdbcType.INTEGER)
    })
    List<Menu> selectByExample(MenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Select({
        "select",
        "menu_id, menu_parent_id, menu_name, menu_description, menu_url, menu_icon, menu_index, ",
        "menu_type, menu_level, menu_valid",
        "from menu",
        "where menu_id = #{menuId,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="menu_parent_id", property="menuParentId", jdbcType=JdbcType.CHAR),
        @Result(column="menu_name", property="menuName", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_description", property="menuDescription", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_url", property="menuUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_icon", property="menuIcon", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_index", property="menuIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_type", property="menuType", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_level", property="menuLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_valid", property="menuValid", jdbcType=JdbcType.INTEGER)
    })
    Menu selectByPrimaryKey(String menuId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=MenuSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Menu record, @Param("example") MenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=MenuSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Menu record, @Param("example") MenuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=MenuSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Menu record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table menu
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Update({
        "update menu",
        "set menu_parent_id = #{menuParentId,jdbcType=CHAR},",
          "menu_name = #{menuName,jdbcType=VARCHAR},",
          "menu_description = #{menuDescription,jdbcType=VARCHAR},",
          "menu_url = #{menuUrl,jdbcType=VARCHAR},",
          "menu_icon = #{menuIcon,jdbcType=VARCHAR},",
          "menu_index = #{menuIndex,jdbcType=INTEGER},",
          "menu_type = #{menuType,jdbcType=VARCHAR},",
          "menu_level = #{menuLevel,jdbcType=INTEGER},",
          "menu_valid = #{menuValid,jdbcType=INTEGER}",
        "where menu_id = #{menuId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Menu record);
}